﻿using NHibernate;
using NHibernate.Engine;
using System;

namespace Shape.Mvp.Persistence.Conversations.Hibernate
{
   public class HibernateConversationContainerAccessor : IConversationContainerAccessor
   {
      private readonly IConversationContainer container;

      public HibernateConversationContainerAccessor(ISessionFactory sessionFactory) 
      {
         var factoryImplementor = sessionFactory as ISessionFactoryImplementor;

         container = factoryImplementor.CurrentSessionContext as IConversationContainer;
      }

      public IConversationContainer Container
      {
         get { return container; }
      }
   }
}
